package com.qianfeng.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Date;
import com.qianfeng.db1.service.UsersService;
import com.qianfeng.db5.service.UserService;
import com.qianfeng.pojo.User;
import com.qianfeng.pojo.Users;

@Controller
public class IndexController {

	@Autowired
	private UsersService usersService;
	@Autowired
	private UserService userService;
	
	@RequestMapping("/addusers")
	@ResponseBody
	public String addUsers() {
		Users u=new Users();
		u.setName("张三");
		u.setPassword("1234");
		usersService.saveUser(u);
		return "add users success";
	}
	
	@RequestMapping("/adduser")
	@ResponseBody
	public String addUser() {
		User u = new User();
		u.setId(1);
		u.setUsername("user");
		u.setBirthday(new Date());
		userService.saveUser(u);
		return "add user success";
		
	}
}
